﻿function TroubleshootingViewModel() {
    var self = this;
    self.showButton = function (data, type, row, meta) {
        var url = '<div class="btn-group"><a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" data-search=\"\" href=\"/Troubleshooting/Confirmation/' +
            row.id +
            '?ListControlId=%23troubleshootingDataList\">确认</a>';
        if (row.confirmation && row.confirmation.dangerConfirmation == null) {

        }

        if (row.confirmation && row.confirmation.dangerConfirmation == true) {
            url += '<a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" href=\"/Troubleshooting/Rectification/' + row.id + '\">整改</a>';
        } else {
            url += '<a class=\"btn btn-default btn-xs disabled\" href=\"#\">整改</a>';
        }
        //整改日期
        if (row.rectification && row.rectification.rectificationDate) {
            url += '<a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" href=\"/Troubleshooting/Acceptance/' + row.id + '\">验收</a>';
        } else {
            url += '<a class=\"btn btn-default btn-xs disabled\" href=\"#\">验收</a>';
        }
        if (row.acceptance && row.acceptance.acceptanceTime)
            url += '<a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" href=\"/Troubleshooting/WriteOff/' + row.id + '\">销账</a>';
        else
            url += '<a class=\"btn btn-default btn-xs disabled\" href=\"#\">销账</a>';

        return url+"</div>";
    }

}